package strain.domain;

import java.util.Collection;

import strain.expression.BaseExpression;
import strain.expression.IntExpression;

public class IntDomain extends BaseExpression<Integer, IntDomain> implements IntExpression, DiscreteDomain<Integer> {

    private final EnumDomain<Integer> domain;
    
    public IntDomain(final Collection<Integer> values){
        this.domain = new EnumDomain<Integer>(values);
    }

    public IntDomain getDomain() {
        return this;
    }

    public int size(){
        return this.domain.size();
    }
    
    public boolean isBound() {
        return this.domain.isBound();
    }

    public Integer getBoundValue() {
        return this.domain.getBoundValue();
    }

    public boolean bind(final Integer value) throws InconsistentDomainException {
        return this.domain.bind(value);
    }

    public boolean retain(final IntDomain values) throws InconsistentDomainException {
        return this.domain.retain(values.domain);
    }

    public boolean remove(final IntDomain values) throws InconsistentDomainException {
        return this.domain.remove(values.domain);
    }

    public boolean remove(final Integer value) throws InconsistentDomainException {
        return this.domain.remove(value);
    }

    public boolean propagate() {
        return false;
    }
    
    @Override
    public String toString(){
        return "Int[" + this.id + "]:" + this.domain.set;
    }
    
}
